import { app, Tray, Menu } from 'electron'
import path from 'path';


//系统托盘右键菜单
var trayMenuTemplate = [
    {
        label: '设置',
        click: function () { } //打开相应页面
    },
    {
        label: '意见反馈',
        click: function () { }
    },
    {
        label: '帮助',
        click: function () { }
    },
    {
        label: '关于',
        click: function () { }
    },
    {
        label: '退出微信',
        click: function () {
            app.quit();
        }
    }
];

//系统托盘图标目录
let trayIcon = path.join(__dirname, "../renderer/assets");

let appTray = new Tray(path.join(trayIcon, 'zhangsan.ico'));

//图标的上下文菜单
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate);

//设置此托盘图标的悬停提示内容
appTray.setToolTip('This is my application.');

//设置此图标的上下文菜单
appTray.setContextMenu(contextMenu);